
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8" />
  
  <!-- Licensed under the Apache 2.0 License -->
  <link rel="stylesheet" type="text/css" href="../../../_static/fonts/open-sans/stylesheet.css" />
  <!-- Licensed under the SIL Open Font License -->
  <link rel="stylesheet" type="text/css" href="../../../_static/fonts/source-serif-pro/source-serif-pro.css" />
  <link rel="stylesheet" type="text/css" href="../../../_static/css/bootstrap.min.css" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
    <title>jmetal.operator.mutation &#8212; jMetalPy 1.5.3 documentation</title>
    <link rel="stylesheet" href="../../../_static/guzzle.css" type="text/css" />
    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../../../_static/custom.css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../../_static/doctools.js"></script>
    <script type="text/javascript" src="../../../_static/language_data.js"></script>
    <script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
    <script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true, "ignoreClass": "document", "processClass": "math|output_area"}})</script>
    <link rel="index" title="Index" href="../../../genindex.html" />
    <link rel="search" title="Search" href="../../../search.html" />
  
   

  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../../index.html">jMetalPy 1.5.3 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../index.html" accesskey="U">Module code</a> &#187;</li> 
      </ul>
    </div>
    <div class="container-wrapper">

      <div id="mobile-toggle">
        <a href="#"><span class="glyphicon glyphicon-align-justify" aria-hidden="true"></span></a>
      </div>
  <div id="left-column">
    <div class="sphinxsidebar"><a href="
    ../../../index.html" class="text-logo">
    <img src="_static/jmetalpy.png" class="img-fluid" alt="jMetalPy 1.5.3 documentation">
    <br>
</a>

<div class="sidebar-block">
  <div class="sidebar-wrapper">
    Python version of the jMetal framework
  </div>
</div>
<div class="sidebar-block">
  <div class="sidebar-wrapper">
    <h2>Table Of Contents</h2>
  </div>
  <div class="sidebar-toc">
    
    
      <ul>
<li class="toctree-l1"><a class="reference internal" href="../../../tutorials.html">Getting started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../multiobjective.algorithms.html">Multi-objective algorithms</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../singleobjective.algorithms.html">Single-objective algorithms</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../operators.html">Operators</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../problems.html">Problems</a></li>
</ul>

    
  </div>
</div>
<div class="sidebar-block">
  <div class="sidebar-wrapper">
    <div id="main-search">
      <form class="form-inline" action="../../../search.html" method="GET" role="form">
        <div class="input-group">
          <input name="q" type="text" class="form-control" placeholder="Search...">
        </div>
        <input type="hidden" name="check_keywords" value="yes" />
        <input type="hidden" name="area" value="default" />
      </form>
    </div>
  </div>
</div>
      
    </div>
  </div>
        <div id="right-column">
          
          <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
              <li class="breadcrumb-item"><a href="../../../index.html">Docs</a></li>
              
              <li class="breadcrumb-item"><a href="../../index.html">Module code</a></li>
              
              <li class="breadcrumb-item">jmetal.operator.mutation</li>
            </ol>
          </nav>
          
          <div class="document clearer body">
            
  <h1>Source code for jmetal.operator.mutation</h1><div class="highlight"><pre>
<span></span><span class="kn">import</span> <span class="nn">random</span>

<span class="kn">from</span> <span class="nn">jmetal.core.operator</span> <span class="kn">import</span> <span class="n">Mutation</span>
<span class="kn">from</span> <span class="nn">jmetal.core.solution</span> <span class="kn">import</span> <span class="n">BinarySolution</span><span class="p">,</span> <span class="n">Solution</span><span class="p">,</span> <span class="n">FloatSolution</span><span class="p">,</span> <span class="n">IntegerSolution</span><span class="p">,</span> <span class="n">PermutationSolution</span>

<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">.. module:: mutation</span>
<span class="sd">   :platform: Unix, Windows</span>
<span class="sd">   :synopsis: Module implementing mutation operators.</span>

<span class="sd">.. moduleauthor:: Antonio J. Nebro &lt;antonio@lcc.uma.es&gt;, Antonio Benítez-Hidalgo &lt;antonio.b@uma.es&gt;</span>
<span class="sd">&quot;&quot;&quot;</span>


<div class="viewcode-block" id="NullMutation"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.NullMutation">[docs]</a><span class="k">class</span> <span class="nc">NullMutation</span><span class="p">(</span><span class="n">Mutation</span><span class="p">[</span><span class="n">Solution</span><span class="p">]):</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="nb">super</span><span class="p">(</span><span class="n">NullMutation</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">probability</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>

<div class="viewcode-block" id="NullMutation.execute"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.NullMutation.execute">[docs]</a>    <span class="k">def</span> <span class="nf">execute</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">solution</span><span class="p">:</span> <span class="n">Solution</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Solution</span><span class="p">:</span>
        <span class="k">return</span> <span class="n">solution</span></div>

<div class="viewcode-block" id="NullMutation.get_name"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.NullMutation.get_name">[docs]</a>    <span class="k">def</span> <span class="nf">get_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="s1">&#39;Null mutation&#39;</span></div></div>


<div class="viewcode-block" id="BitFlipMutation"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.BitFlipMutation">[docs]</a><span class="k">class</span> <span class="nc">BitFlipMutation</span><span class="p">(</span><span class="n">Mutation</span><span class="p">[</span><span class="n">BinarySolution</span><span class="p">]):</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">probability</span><span class="p">:</span> <span class="nb">float</span><span class="p">):</span>
        <span class="nb">super</span><span class="p">(</span><span class="n">BitFlipMutation</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">probability</span><span class="o">=</span><span class="n">probability</span><span class="p">)</span>

<div class="viewcode-block" id="BitFlipMutation.execute"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.BitFlipMutation.execute">[docs]</a>    <span class="k">def</span> <span class="nf">execute</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">solution</span><span class="p">:</span> <span class="n">BinarySolution</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">BinarySolution</span><span class="p">:</span>
        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">number_of_variables</span><span class="p">):</span>
            <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">i</span><span class="p">])):</span>
                <span class="n">rand</span> <span class="o">=</span> <span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">()</span>
                <span class="k">if</span> <span class="n">rand</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">probability</span><span class="p">:</span>
                    <span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">j</span><span class="p">]</span> <span class="o">=</span> <span class="kc">True</span> <span class="k">if</span> <span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">j</span><span class="p">]</span> <span class="ow">is</span> <span class="kc">False</span> <span class="k">else</span> <span class="kc">False</span>

        <span class="k">return</span> <span class="n">solution</span></div>

<div class="viewcode-block" id="BitFlipMutation.get_name"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.BitFlipMutation.get_name">[docs]</a>    <span class="k">def</span> <span class="nf">get_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="s1">&#39;BitFlip mutation&#39;</span></div></div>


<div class="viewcode-block" id="PolynomialMutation"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.PolynomialMutation">[docs]</a><span class="k">class</span> <span class="nc">PolynomialMutation</span><span class="p">(</span><span class="n">Mutation</span><span class="p">[</span><span class="n">FloatSolution</span><span class="p">]):</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">probability</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span> <span class="n">distribution_index</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.20</span><span class="p">):</span>
        <span class="nb">super</span><span class="p">(</span><span class="n">PolynomialMutation</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">probability</span><span class="o">=</span><span class="n">probability</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">distribution_index</span> <span class="o">=</span> <span class="n">distribution_index</span>

<div class="viewcode-block" id="PolynomialMutation.execute"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.PolynomialMutation.execute">[docs]</a>    <span class="k">def</span> <span class="nf">execute</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">solution</span><span class="p">:</span> <span class="n">FloatSolution</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">FloatSolution</span><span class="p">:</span>
        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">number_of_variables</span><span class="p">):</span>
            <span class="n">rand</span> <span class="o">=</span> <span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">()</span>

            <span class="k">if</span> <span class="n">rand</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">probability</span><span class="p">:</span>
                <span class="n">y</span> <span class="o">=</span> <span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
                <span class="n">yl</span><span class="p">,</span> <span class="n">yu</span> <span class="o">=</span> <span class="n">solution</span><span class="o">.</span><span class="n">lower_bound</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="n">solution</span><span class="o">.</span><span class="n">upper_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>

                <span class="k">if</span> <span class="n">yl</span> <span class="o">==</span> <span class="n">yu</span><span class="p">:</span>
                    <span class="n">y</span> <span class="o">=</span> <span class="n">yl</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="n">delta1</span> <span class="o">=</span> <span class="p">(</span><span class="n">y</span> <span class="o">-</span> <span class="n">yl</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">yu</span> <span class="o">-</span> <span class="n">yl</span><span class="p">)</span>
                    <span class="n">delta2</span> <span class="o">=</span> <span class="p">(</span><span class="n">yu</span> <span class="o">-</span> <span class="n">y</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">yu</span> <span class="o">-</span> <span class="n">yl</span><span class="p">)</span>
                    <span class="n">rnd</span> <span class="o">=</span> <span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">()</span>
                    <span class="n">mut_pow</span> <span class="o">=</span> <span class="mf">1.0</span> <span class="o">/</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">distribution_index</span> <span class="o">+</span> <span class="mf">1.0</span><span class="p">)</span>
                    <span class="k">if</span> <span class="n">rnd</span> <span class="o">&lt;=</span> <span class="mf">0.5</span><span class="p">:</span>
                        <span class="n">xy</span> <span class="o">=</span> <span class="mf">1.0</span> <span class="o">-</span> <span class="n">delta1</span>
                        <span class="n">val</span> <span class="o">=</span> <span class="mf">2.0</span> <span class="o">*</span> <span class="n">rnd</span> <span class="o">+</span> <span class="p">(</span><span class="mf">1.0</span> <span class="o">-</span> <span class="mf">2.0</span> <span class="o">*</span> <span class="n">rnd</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="nb">pow</span><span class="p">(</span><span class="n">xy</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">distribution_index</span> <span class="o">+</span> <span class="mf">1.0</span><span class="p">))</span>
                        <span class="n">deltaq</span> <span class="o">=</span> <span class="nb">pow</span><span class="p">(</span><span class="n">val</span><span class="p">,</span> <span class="n">mut_pow</span><span class="p">)</span> <span class="o">-</span> <span class="mf">1.0</span>
                    <span class="k">else</span><span class="p">:</span>
                        <span class="n">xy</span> <span class="o">=</span> <span class="mf">1.0</span> <span class="o">-</span> <span class="n">delta2</span>
                        <span class="n">val</span> <span class="o">=</span> <span class="mf">2.0</span> <span class="o">*</span> <span class="p">(</span><span class="mf">1.0</span> <span class="o">-</span> <span class="n">rnd</span><span class="p">)</span> <span class="o">+</span> <span class="mf">2.0</span> <span class="o">*</span> <span class="p">(</span><span class="n">rnd</span> <span class="o">-</span> <span class="mf">0.5</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="nb">pow</span><span class="p">(</span><span class="n">xy</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">distribution_index</span> <span class="o">+</span> <span class="mf">1.0</span><span class="p">))</span>
                        <span class="n">deltaq</span> <span class="o">=</span> <span class="mf">1.0</span> <span class="o">-</span> <span class="nb">pow</span><span class="p">(</span><span class="n">val</span><span class="p">,</span> <span class="n">mut_pow</span><span class="p">)</span>

                    <span class="n">y</span> <span class="o">+=</span> <span class="n">deltaq</span> <span class="o">*</span> <span class="p">(</span><span class="n">yu</span> <span class="o">-</span> <span class="n">yl</span><span class="p">)</span>
                    <span class="k">if</span> <span class="n">y</span> <span class="o">&lt;</span> <span class="n">solution</span><span class="o">.</span><span class="n">lower_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]:</span>
                        <span class="n">y</span> <span class="o">=</span> <span class="n">solution</span><span class="o">.</span><span class="n">lower_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
                    <span class="k">if</span> <span class="n">y</span> <span class="o">&gt;</span> <span class="n">solution</span><span class="o">.</span><span class="n">upper_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]:</span>
                        <span class="n">y</span> <span class="o">=</span> <span class="n">solution</span><span class="o">.</span><span class="n">upper_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>

                <span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">y</span>

        <span class="k">return</span> <span class="n">solution</span></div>

<div class="viewcode-block" id="PolynomialMutation.get_name"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.PolynomialMutation.get_name">[docs]</a>    <span class="k">def</span> <span class="nf">get_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="s1">&#39;Polynomial mutation&#39;</span></div></div>


<div class="viewcode-block" id="IntegerPolynomialMutation"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.IntegerPolynomialMutation">[docs]</a><span class="k">class</span> <span class="nc">IntegerPolynomialMutation</span><span class="p">(</span><span class="n">Mutation</span><span class="p">[</span><span class="n">IntegerSolution</span><span class="p">]):</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">probability</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span> <span class="n">distribution_index</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.20</span><span class="p">):</span>
        <span class="nb">super</span><span class="p">(</span><span class="n">IntegerPolynomialMutation</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">probability</span><span class="o">=</span><span class="n">probability</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">distribution_index</span> <span class="o">=</span> <span class="n">distribution_index</span>

<div class="viewcode-block" id="IntegerPolynomialMutation.execute"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.IntegerPolynomialMutation.execute">[docs]</a>    <span class="k">def</span> <span class="nf">execute</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">solution</span><span class="p">:</span> <span class="n">IntegerSolution</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">IntegerSolution</span><span class="p">:</span>
        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">number_of_variables</span><span class="p">):</span>
            <span class="k">if</span> <span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">()</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">probability</span><span class="p">:</span>
                <span class="n">y</span> <span class="o">=</span> <span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
                <span class="n">yl</span><span class="p">,</span> <span class="n">yu</span> <span class="o">=</span> <span class="n">solution</span><span class="o">.</span><span class="n">lower_bound</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="n">solution</span><span class="o">.</span><span class="n">upper_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>

                <span class="k">if</span> <span class="n">yl</span> <span class="o">==</span> <span class="n">yu</span><span class="p">:</span>
                    <span class="n">y</span> <span class="o">=</span> <span class="n">yl</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="n">delta1</span> <span class="o">=</span> <span class="p">(</span><span class="n">y</span> <span class="o">-</span> <span class="n">yl</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">yu</span> <span class="o">-</span> <span class="n">yl</span><span class="p">)</span>
                    <span class="n">delta2</span> <span class="o">=</span> <span class="p">(</span><span class="n">yu</span> <span class="o">-</span> <span class="n">y</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">yu</span> <span class="o">-</span> <span class="n">yl</span><span class="p">)</span>
                    <span class="n">mut_pow</span> <span class="o">=</span> <span class="mf">1.0</span> <span class="o">/</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">distribution_index</span> <span class="o">+</span> <span class="mf">1.0</span><span class="p">)</span>
                    <span class="n">rnd</span> <span class="o">=</span> <span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">()</span>
                    <span class="k">if</span> <span class="n">rnd</span> <span class="o">&lt;=</span> <span class="mf">0.5</span><span class="p">:</span>
                        <span class="n">xy</span> <span class="o">=</span> <span class="mf">1.0</span> <span class="o">-</span> <span class="n">delta1</span>
                        <span class="n">val</span> <span class="o">=</span> <span class="mf">2.0</span> <span class="o">*</span> <span class="n">rnd</span> <span class="o">+</span> <span class="p">(</span><span class="mf">1.0</span> <span class="o">-</span> <span class="mf">2.0</span> <span class="o">*</span> <span class="n">rnd</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="n">xy</span> <span class="o">**</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">distribution_index</span> <span class="o">+</span> <span class="mf">1.0</span><span class="p">))</span>
                        <span class="n">deltaq</span> <span class="o">=</span> <span class="n">val</span> <span class="o">**</span> <span class="n">mut_pow</span> <span class="o">-</span> <span class="mf">1.0</span>
                    <span class="k">else</span><span class="p">:</span>
                        <span class="n">xy</span> <span class="o">=</span> <span class="mf">1.0</span> <span class="o">-</span> <span class="n">delta2</span>
                        <span class="n">val</span> <span class="o">=</span> <span class="mf">2.0</span> <span class="o">*</span> <span class="p">(</span><span class="mf">1.0</span> <span class="o">-</span> <span class="n">rnd</span><span class="p">)</span> <span class="o">+</span> <span class="mf">2.0</span> <span class="o">*</span> <span class="p">(</span><span class="n">rnd</span> <span class="o">-</span> <span class="mf">0.5</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="n">xy</span> <span class="o">**</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">distribution_index</span> <span class="o">+</span> <span class="mf">1.0</span><span class="p">))</span>
                        <span class="n">deltaq</span> <span class="o">=</span> <span class="mf">1.0</span> <span class="o">-</span> <span class="n">val</span> <span class="o">**</span> <span class="n">mut_pow</span>

                    <span class="n">y</span> <span class="o">+=</span> <span class="n">deltaq</span> <span class="o">*</span> <span class="p">(</span><span class="n">yu</span> <span class="o">-</span> <span class="n">yl</span><span class="p">)</span>
                    <span class="k">if</span> <span class="n">y</span> <span class="o">&lt;</span> <span class="n">solution</span><span class="o">.</span><span class="n">lower_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]:</span>
                        <span class="n">y</span> <span class="o">=</span> <span class="n">solution</span><span class="o">.</span><span class="n">lower_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
                    <span class="k">if</span> <span class="n">y</span> <span class="o">&gt;</span> <span class="n">solution</span><span class="o">.</span><span class="n">upper_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]:</span>
                        <span class="n">y</span> <span class="o">=</span> <span class="n">solution</span><span class="o">.</span><span class="n">upper_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>

                <span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="nb">round</span><span class="p">(</span><span class="n">y</span><span class="p">))</span>
        <span class="k">return</span> <span class="n">solution</span></div>

<div class="viewcode-block" id="IntegerPolynomialMutation.get_name"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.IntegerPolynomialMutation.get_name">[docs]</a>    <span class="k">def</span> <span class="nf">get_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="s1">&#39;Polynomial mutation (Integer)&#39;</span></div></div>


<div class="viewcode-block" id="SimpleRandomMutation"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.SimpleRandomMutation">[docs]</a><span class="k">class</span> <span class="nc">SimpleRandomMutation</span><span class="p">(</span><span class="n">Mutation</span><span class="p">[</span><span class="n">FloatSolution</span><span class="p">]):</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">probability</span><span class="p">:</span> <span class="nb">float</span><span class="p">):</span>
        <span class="nb">super</span><span class="p">(</span><span class="n">SimpleRandomMutation</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">probability</span><span class="o">=</span><span class="n">probability</span><span class="p">)</span>

<div class="viewcode-block" id="SimpleRandomMutation.execute"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.SimpleRandomMutation.execute">[docs]</a>    <span class="k">def</span> <span class="nf">execute</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">solution</span><span class="p">:</span> <span class="n">FloatSolution</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">FloatSolution</span><span class="p">:</span>
        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">number_of_variables</span><span class="p">):</span>
            <span class="n">rand</span> <span class="o">=</span> <span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">()</span>
            <span class="k">if</span> <span class="n">rand</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">probability</span><span class="p">:</span>
                <span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">solution</span><span class="o">.</span><span class="n">lower_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">+</span> \
                                        <span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">upper_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">-</span> <span class="n">solution</span><span class="o">.</span><span class="n">lower_bound</span><span class="p">[</span><span class="n">i</span><span class="p">])</span> <span class="o">*</span> <span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">()</span>
        <span class="k">return</span> <span class="n">solution</span></div>

<div class="viewcode-block" id="SimpleRandomMutation.get_name"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.SimpleRandomMutation.get_name">[docs]</a>    <span class="k">def</span> <span class="nf">get_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="s1">&#39;Simple random_search mutation&#39;</span></div></div>


<div class="viewcode-block" id="UniformMutation"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.UniformMutation">[docs]</a><span class="k">class</span> <span class="nc">UniformMutation</span><span class="p">(</span><span class="n">Mutation</span><span class="p">[</span><span class="n">FloatSolution</span><span class="p">]):</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">probability</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span> <span class="n">perturbation</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.5</span><span class="p">):</span>
        <span class="nb">super</span><span class="p">(</span><span class="n">UniformMutation</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">probability</span><span class="o">=</span><span class="n">probability</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">perturbation</span> <span class="o">=</span> <span class="n">perturbation</span>

<div class="viewcode-block" id="UniformMutation.execute"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.UniformMutation.execute">[docs]</a>    <span class="k">def</span> <span class="nf">execute</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">solution</span><span class="p">:</span> <span class="n">FloatSolution</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">FloatSolution</span><span class="p">:</span>
        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">number_of_variables</span><span class="p">):</span>
            <span class="n">rand</span> <span class="o">=</span> <span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">()</span>

            <span class="k">if</span> <span class="n">rand</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">probability</span><span class="p">:</span>
                <span class="n">tmp</span> <span class="o">=</span> <span class="p">(</span><span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">()</span> <span class="o">-</span> <span class="mf">0.5</span><span class="p">)</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">perturbation</span>
                <span class="n">tmp</span> <span class="o">+=</span> <span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>

                <span class="k">if</span> <span class="n">tmp</span> <span class="o">&lt;</span> <span class="n">solution</span><span class="o">.</span><span class="n">lower_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]:</span>
                    <span class="n">tmp</span> <span class="o">=</span> <span class="n">solution</span><span class="o">.</span><span class="n">lower_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
                <span class="k">elif</span> <span class="n">tmp</span> <span class="o">&gt;</span> <span class="n">solution</span><span class="o">.</span><span class="n">upper_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]:</span>
                    <span class="n">tmp</span> <span class="o">=</span> <span class="n">solution</span><span class="o">.</span><span class="n">upper_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>

                <span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">tmp</span>

        <span class="k">return</span> <span class="n">solution</span></div>

<div class="viewcode-block" id="UniformMutation.get_name"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.UniformMutation.get_name">[docs]</a>    <span class="k">def</span> <span class="nf">get_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="s1">&#39;Uniform mutation&#39;</span></div></div>


<div class="viewcode-block" id="NonUniformMutation"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.NonUniformMutation">[docs]</a><span class="k">class</span> <span class="nc">NonUniformMutation</span><span class="p">(</span><span class="n">Mutation</span><span class="p">[</span><span class="n">FloatSolution</span><span class="p">]):</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">probability</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span> <span class="n">perturbation</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.5</span><span class="p">,</span> <span class="n">max_iterations</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mf">0.5</span><span class="p">):</span>
        <span class="nb">super</span><span class="p">(</span><span class="n">NonUniformMutation</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">probability</span><span class="o">=</span><span class="n">probability</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">perturbation</span> <span class="o">=</span> <span class="n">perturbation</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">max_iterations</span> <span class="o">=</span> <span class="n">max_iterations</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">current_iteration</span> <span class="o">=</span> <span class="mi">0</span>

<div class="viewcode-block" id="NonUniformMutation.execute"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.NonUniformMutation.execute">[docs]</a>    <span class="k">def</span> <span class="nf">execute</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">solution</span><span class="p">:</span> <span class="n">FloatSolution</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">FloatSolution</span><span class="p">:</span>
        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">number_of_variables</span><span class="p">):</span>
            <span class="k">if</span> <span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">()</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">probability</span><span class="p">:</span>
                <span class="n">rand</span> <span class="o">=</span> <span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">()</span>

                <span class="k">if</span> <span class="n">rand</span> <span class="o">&lt;=</span> <span class="mf">0.5</span><span class="p">:</span>
                    <span class="n">tmp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__delta</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">upper_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">-</span> <span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">perturbation</span><span class="p">)</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="n">tmp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__delta</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">lower_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">-</span> <span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">perturbation</span><span class="p">)</span>

                <span class="n">tmp</span> <span class="o">+=</span> <span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>

                <span class="k">if</span> <span class="n">tmp</span> <span class="o">&lt;</span> <span class="n">solution</span><span class="o">.</span><span class="n">lower_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]:</span>
                    <span class="n">tmp</span> <span class="o">=</span> <span class="n">solution</span><span class="o">.</span><span class="n">lower_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
                <span class="k">elif</span> <span class="n">tmp</span> <span class="o">&gt;</span> <span class="n">solution</span><span class="o">.</span><span class="n">upper_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]:</span>
                    <span class="n">tmp</span> <span class="o">=</span> <span class="n">solution</span><span class="o">.</span><span class="n">upper_bound</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>

                <span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">tmp</span>

        <span class="k">return</span> <span class="n">solution</span></div>

<div class="viewcode-block" id="NonUniformMutation.set_current_iteration"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.NonUniformMutation.set_current_iteration">[docs]</a>    <span class="k">def</span> <span class="nf">set_current_iteration</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">current_iteration</span><span class="p">:</span> <span class="nb">int</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">current_iteration</span> <span class="o">=</span> <span class="n">current_iteration</span></div>

    <span class="k">def</span> <span class="nf">__delta</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">y</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span> <span class="n">b_mutation_parameter</span><span class="p">:</span> <span class="nb">float</span><span class="p">):</span>
        <span class="k">return</span> <span class="p">(</span><span class="n">y</span> <span class="o">*</span> <span class="p">(</span><span class="mf">1.0</span> <span class="o">-</span> <span class="nb">pow</span><span class="p">(</span><span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">(),</span>
                               <span class="nb">pow</span><span class="p">((</span><span class="mf">1.0</span> <span class="o">-</span> <span class="mf">1.0</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">current_iteration</span> <span class="o">/</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_iterations</span><span class="p">),</span> <span class="n">b_mutation_parameter</span><span class="p">))))</span>

<div class="viewcode-block" id="NonUniformMutation.get_name"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.NonUniformMutation.get_name">[docs]</a>    <span class="k">def</span> <span class="nf">get_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="s1">&#39;Uniform mutation&#39;</span></div></div>


<div class="viewcode-block" id="PermutationSwapMutation"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.PermutationSwapMutation">[docs]</a><span class="k">class</span> <span class="nc">PermutationSwapMutation</span><span class="p">(</span><span class="n">Mutation</span><span class="p">[</span><span class="n">PermutationSolution</span><span class="p">]):</span>

<div class="viewcode-block" id="PermutationSwapMutation.execute"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.PermutationSwapMutation.execute">[docs]</a>    <span class="k">def</span> <span class="nf">execute</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">solution</span><span class="p">:</span> <span class="n">PermutationSolution</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">PermutationSolution</span><span class="p">:</span>
        <span class="n">rand</span> <span class="o">=</span> <span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">()</span>

        <span class="k">if</span> <span class="n">rand</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">probability</span><span class="p">:</span>
            <span class="n">pos_one</span><span class="p">,</span> <span class="n">pos_two</span> <span class="o">=</span> <span class="n">random</span><span class="o">.</span><span class="n">sample</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">number_of_variables</span> <span class="o">-</span> <span class="mi">1</span><span class="p">),</span> <span class="mi">2</span><span class="p">)</span>
            <span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">pos_one</span><span class="p">],</span> <span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">pos_two</span><span class="p">]</span> <span class="o">=</span> \
                <span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">pos_two</span><span class="p">],</span> <span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">pos_one</span><span class="p">]</span>

        <span class="k">return</span> <span class="n">solution</span></div>

<div class="viewcode-block" id="PermutationSwapMutation.get_name"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.PermutationSwapMutation.get_name">[docs]</a>    <span class="k">def</span> <span class="nf">get_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="s1">&#39;Permutation Swap mutation&#39;</span></div></div>


<div class="viewcode-block" id="ScrambleMutation"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.ScrambleMutation">[docs]</a><span class="k">class</span> <span class="nc">ScrambleMutation</span><span class="p">(</span><span class="n">Mutation</span><span class="p">[</span><span class="n">PermutationSolution</span><span class="p">]):</span>

<div class="viewcode-block" id="ScrambleMutation.execute"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.ScrambleMutation.execute">[docs]</a>    <span class="k">def</span> <span class="nf">execute</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">solution</span><span class="p">:</span> <span class="n">PermutationSolution</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">PermutationSolution</span><span class="p">:</span>
        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">number_of_variables</span><span class="p">):</span>
            <span class="n">rand</span> <span class="o">=</span> <span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">()</span>

            <span class="k">if</span> <span class="n">rand</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">probability</span><span class="p">:</span>
                <span class="n">point1</span> <span class="o">=</span> <span class="n">random</span><span class="o">.</span><span class="n">randint</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">i</span><span class="p">]))</span>
                <span class="n">point2</span> <span class="o">=</span> <span class="n">random</span><span class="o">.</span><span class="n">randint</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">i</span><span class="p">])</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span>

                <span class="k">if</span> <span class="n">point2</span> <span class="o">&gt;=</span> <span class="n">point1</span><span class="p">:</span>
                    <span class="n">point2</span> <span class="o">+=</span> <span class="mi">1</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="n">point1</span><span class="p">,</span> <span class="n">point2</span> <span class="o">=</span> <span class="n">point2</span><span class="p">,</span> <span class="n">point1</span>

                <span class="k">if</span> <span class="n">point2</span> <span class="o">-</span> <span class="n">point1</span> <span class="o">&gt;=</span> <span class="mi">20</span><span class="p">:</span>
                    <span class="n">point2</span> <span class="o">=</span> <span class="n">point1</span> <span class="o">+</span> <span class="mi">20</span>

                <span class="n">values</span> <span class="o">=</span> <span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">point1</span><span class="p">:</span><span class="n">point2</span><span class="p">]</span>
                <span class="n">solution</span><span class="o">.</span><span class="n">variables</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">point1</span><span class="p">:</span><span class="n">point2</span><span class="p">]</span> <span class="o">=</span> <span class="n">random</span><span class="o">.</span><span class="n">sample</span><span class="p">(</span><span class="n">values</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">values</span><span class="p">))</span>

        <span class="k">return</span> <span class="n">solution</span></div>

<div class="viewcode-block" id="ScrambleMutation.get_name"><a class="viewcode-back" href="../../../api/operator/mutation.html#jmetal.operator.mutation.ScrambleMutation.get_name">[docs]</a>    <span class="k">def</span> <span class="nf">get_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="s1">&#39;Scramble&#39;</span></div></div>
</pre></div>

          </div>
            
        </div>
        <div class="clearfix"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../../index.html">jMetalPy 1.5.3 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../index.html" >Module code</a> &#187;</li> 
      </ul>
    </div>
<script type="text/javascript">
  $("#mobile-toggle a").click(function () {
    $("#left-column").toggle();
  });
</script>
<script type="text/javascript" src="../../../_static/js/bootstrap.js"></script>
  <div class="footer">
    &copy; Copyright 2019, Antonio Benítez-Hidalgo. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
  </div>
  </body>
</html>